﻿@{
    ViewBag.Title = "冲压件剪切下料卡管理";
    Layout = "~/Views/Shared/_ManufactureList.cshtml";
}
<link href="~/Content/css/BlankingcardManagement_print.css" rel="stylesheet" media="print" />
<style type="text/css">
    .tool_c {
        padding: 10px 0;
    }

    .btn-group {
        padding: 0 10px 0 0;
    }

    .grid_list_2_c {
        overflow: hidden;
    }

        .grid_list_2_c .frozen-bdiv {
            top: 34px !important;
        }

        .grid_list_2_c .frozen-div {
            height: 3em !important;
        }

        .grid_list_2_c .ui-jqgrid-hdiv {
            width: 1900px !important;
            background-color: transparent !important;
        }

        .grid_list_2_c .ui-jqgrid-bdiv {
            width: 1900px !important;
            background-color: transparent !important;
        }

        .grid_list_2_c .ui-jqgrid-btable {
            background-color: #fff !important;
        }

    .btn-group:last-child a.btn:first-child {
        margin: 0 0.5em 0 0 !important;
    }

    .input_inline input{
        display:inline-block;
        width:4em;
    }

</style>
<script>
    $(function () {
        Index.init();
    });

    var Index = {
        init: function () {
            with (Index) {
                initControl();

                loadDataList();

                $("#txtStartDate2").val(new Date().format("yyyy-MM-01"));

                $("#txtEndDate2").val(new Date().format("yyyy-MM-{0}".format(getMaxDay())));
            }
        },
        initControl: function () {
            var o = {
                "0": "i11,i12,i13,i4".split(","),
                "1": "i15,i13".split(",")
            };

            $("[name=ra0]").on("click", function () {
                $(".i1").hide(0);

                var arr = o[$(this).val()];

                arr.forEach(function (cur) {
                    $(".{0}".format(cur)).fadeIn(100);
                });
            });

            $('select').bindSelect();
            //供货单位名称
            $(".txt_FProCompanyName").bindSelect({
                url: "/BaseData/ZSJ_B1_GH_SI/GetGridJson?isProduct=1",
                id: "UnitNO",
                text: "UnitNOShortName"
            });
            //仓库基础数据
            $("#FStoreNO").bindSelect({
                url: "/BaseData/ZSJ_B1_GH_SI/GetStockInfo",
                id: "FStoreNO",
                text: "UnitNOShortName"
            });
            //显示台账日期
            var keyValue = $.request("keyValue");
            $.ajax({
                url: "/WareHouse/EnterWareHouse/GetInfoDocumentNum",
                data: { keyValue: keyValue },
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#form1").formSerialize(data);
                    //var dataa =  data.Substring(0, 4);
                    //alert("a");
                    $("#FAccountDate").val(data);
                }
            });
            //零件分类
            $(".txt_FTypeName").bindSelect({//FClassNO ='01'
                url: "/VBaseData/V_BUS_SJ_Dictionary/GetSJ_DictionaryEntity",
                id: "FTypeNO",
                text: "UnitTypeNoName",
            });
            //发生方式
            $(".FTypeNO").bindSelect({//FClassNO ='01'
                url: "/VBaseData/V_BUS_SJ_Dictionary/GetSJ_DictionaryEntityByClassNo?classNo=03",
                id: "FTypeNO",
                text: "UnitTypeNoName",
            });
            //发生单位
            $("#FHappenCompanyNO2").bindSelect({
                url: "/VBaseData/V_BUS_SJ_Dictionary/GetOccurrenceUnit",
                id: "UnitNO",
                text: "UnitShortName",
            });
            //批次查询 btn_search1
            $("#btn_search1").on("click", function () {
                var $gridList1 = $("#gridList1");

                var conn1 = {
                    "FDocuNO": $("#FDocuNO").val(),
                    "FVoucherNo": $("#FVoucherNo").val(),
                    "FHappenCompanyNO": $("#FHappenCompanyNO").val(),
                    "FProductionNO": $("#FProductionNO").val(),
                    "FProductionName": $("#FProductionName").val(),
                    "FProCompanyNO": $("#FProCompanyNO").val(),
                    "FProductionTypeNO": $("#FProductionTypeNO").val(),
                    "FStoreNO": $("#FStoreNO").val()
                };

                $gridList1.jqGrid('setGridParam', {
                    postData: conn1,
                }).trigger('reloadGrid');
            });
        },
        loadDataList: function () {
            var conn1 = {
                "FDocuNO": $("#FDocuNO").val(),
                "FVoucherNo": $("#FVoucherNo").val(),
                "FHappenCompanyNO": $("#FHappenCompanyNO").val(),
                "FProductionNO": $("#FProductionNO").val(),
                "FProductionName": $("#FProductionName").val(),
                "FProCompanyNO": $("#FProCompanyNO").val(),
                "FProductionTypeNO": $("#FProductionTypeNO").val(),
                "FStoreNO": $("#FStoreNO").val()
            };
            var $gridList1 = $("#gridList1");
            $gridList1.dataGridForJson({
                url: "/VBaseData/V_CPK_A1_BB_StoProStockCata_RB/GetGridBatchStoreStat",
                postData: conn1,
                height: $(window).height() - 220,
                colModel: [
                    { label: '下料卡号', name: 'FDocuNO', width: 120, align: 'center', },
                    { label: '显示<br/>说明', name: 'FHappenCompanyNO', width: 40, align: 'center', },
                    { label: "下料<br/>方式", name: 'FHappenCompanyName', width: 40, align: 'center', },
                    { label: '剪切<br/>图形', name: 'FProductionNO', width: 40, align: 'center', },
                    { label: ' 毛坯<br/>符号', name: 'FProductionName', width: 40, align: 'center' },
                    { label: '零件编号', name: 'FQuantity_RK', width: 120, align: 'right' },
                    { label: '材料牌号', name: 'FQuantity_CK', width: 160, align: 'right' },
                    { label: '材料规格', name: 'FQuantity_RK_FQuantity_CK', width: 160, align: 'right' },
                    { label: '开卷尺寸', name: 'FStoreNO', width: 100, align: 'left' },
                    { label: '剪切规格', name: 'FStoreSetNO', width: 160, align: 'left' },
                    { label: '投料重量', name: 'FProCompanyNO', width: 120, align: 'right' },
                    { label: '一张<br/>几块', name: 'FProCompanyName', width: 40, align: 'right' },
                    { label: '一块<br/>几件', name: 'FProductionTypeName', width: 40, align: 'right' },
                    { label: '一张<br/>几件', name: 'FCreateDate', width: 40, align: 'right' },
                    { label: '材料重量<br/>（kg）', name: 'FCreateTime', width: 80, align: 'right' },
                     { label: '材料定额<br/>（kg）', name: 'FCreateTime', width: 80, align: 'right' },
                      { label: '利用率<br/>（%）', name: 'FCreateTime', width: 80,formatter:customFmatter, align: 'right' },
                      { label: '', name: ' ', width: ($(window).width() - 1550), align: 'left', sortable: false }
                ],
                pager: "#gridPager1",
                sortname: 'FProductionNO asc,FProCompanyNO desc',
                viewrecords: true,
                rownumWidth: 50,
                onSelectRow: function (rowId) {
                    rowData = $gridList1.jqGrid('getRowData', rowId);
                    index = rowId;
                    $.each(rowData, function (key, value) {
                        $("#txt" + key).val(value);
                    });
                }
            });

            var customFmatter = function (cellvalue, options, rowObject) {
                return "{0}%".format(cellvalue*100);
            }; 

            $gridList1.jqGrid('setLabel', 0, '序号', 'rowNumberHeaderStyle');
        },
        getMaxDay: function () {
            var r = 31, m = new Date().getMonth() + 1, y = new Date().getFullYear(), sec = [4, 6, 9, 11];
            //能被4整除但不能被100整除，或能被400整除的年份
            2 == m && (r = (((0 == y % 4 && 0 != y % 100) || 0 == y % 400) ? 29 : 28));

            sec.indexOf(m) && (m = 30);

            return r;
        }
    };



</script>
<div class="layout" id="layout" style="height: 100%; width: 100%;">
    <div class="tool_c">
        <div class="btn-group">
            <input type="radio" id="ra01" value="0" name="ra0" checked="checked" /><label for="ra01">编辑	</label><br />
            <input type="radio" id="ra02" value="1" name="ra0" /><label for="ra02">	档案 </label><br />
        </div>
        <div class="btn-group input-width-115">
            &nbsp;下料卡号<br />
            <input id="FProductionNO" name="" placeholder="" type="text" class="form-control required input-width-105" />
        </div>
        <div class="btn-group">
            &nbsp;零件编号<br />
            <input id="FProductionNO1" name="" placeholder="" type="text" class="form-control required input-width-105" />
        </div>
        <div class="btn-group">
            &nbsp;零件名称<br />
            <input id="FProductionName1" name="" placeholder="" type="text" class="form-control required input-width-140" />
        </div>
        <div class="btn-group input-width-105">
            &nbsp;材料牌号<br />
            <input id="MeterialNo" name="" placeholder="" type="text" class="form-control required input-width-140" />
        </div>
        <div class="btn-group input_inline">
            &nbsp;材料规格<br />
            <input id="MeterialSpecificationsW" name="" placeholder="" type="text" class="form-control required" />X
            <input id="MeterialSpecificationsH" name="" placeholder="" type="text" class="form-control required" />X
            <input id="MeterialSpecificationT" name="" placeholder="" type="text" class="form-control required" />
        </div>
        <div class="btn-group">
            <a id="btn_search1" class="btn btn-primary center-block"><span class="glyphicon glyphicon-search"></span>查询</a>
            <a class="btn btn-primary center-block" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span>&nbsp刷新</a>
            <a class="btn btn-primary center-block i1 i11"><span class="glyphicon glyphicon-refresh"></span>输入</a>
            <a class="btn btn-primary center-block i1 i12"><span class="glyphicon glyphicon-print"></span>删除</a>
            <a class="btn btn-primary center-block i1 i13"><span class="glyphicon glyphicon-download"></span>方案</a>
            <a class="btn btn-primary center-block i1 i14"><span class="glyphicon glyphicon-download"></span>发布</a>
            <a class="btn btn-primary center-block i1 i15"><span class="glyphicon glyphicon-download"></span>冻结</a>
        </div>
    </div>
    <div class="grid_list_1_c" style="margin-top: 5px;">
        <table id="gridList1"></table>
        <div id="gridPager1"></div>
    </div>
</div>
